package com.licoba.emoji.utils;


import android.graphics.Color;
import android.support.design.widget.Snackbar;
import android.view.View;
import android.widget.TextView;

import com.androidadvance.topsnackbar.TSnackbar;
import com.licoba.emoji.R;
import com.licoba.emoji.application.MyApplication;

import static cn.bmob.v3.Bmob.getApplicationContext;

/*
 基于Top Snackbar自定义的Snackbar
 */
public class LiSnackbar {

    private static TSnackbar snackbar;
    public static void success(View view,String text){
        snackbar = TSnackbar.make(view,text,TSnackbar.LENGTH_SHORT);
        snackbar.setActionTextColor(Color.WHITE);
        View snackbarView = snackbar.getView();
        snackbarView.setBackgroundColor( getApplicationContext().getResources().getColor(R.color.colorPrimaryDark));
        TextView textView = (TextView) snackbarView.findViewById(com.androidadvance.topsnackbar.R.id.snackbar_text);
        textView.setTextColor(Color.WHITE);
        snackbar.show();
    }


    public static void warning(View view,String text){
        snackbar = TSnackbar.make(view,text,TSnackbar.LENGTH_SHORT);
        snackbar.setActionTextColor(Color.WHITE);
        View snackbarView = snackbar.getView();
        snackbarView.setBackgroundColor( Color.parseColor("#FFAA00"));
        TextView textView = (TextView) snackbarView.findViewById(com.androidadvance.topsnackbar.R.id.snackbar_text);
        textView.setTextColor(Color.WHITE);
        snackbar.show();
    }



    public void make(View view, String text){
        TSnackbar.make(view,text,TSnackbar.LENGTH_SHORT);
    }


    public void error(View view, String text){
        TSnackbar.make(view,text,TSnackbar.LENGTH_SHORT);
    }


    public void show(View view,String text){
        snackbar = TSnackbar.make(view,text,TSnackbar.LENGTH_SHORT);
    }




//    public void short(){
//
//    }
}
